﻿@using Kunlun.BusinessLogic
@model Kunlun.ViewModels.PurchaseView
@{
    ViewBag.Title = "送货地址";
}
@section Head
{
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" type="text/css" rel="Stylesheet" />
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Content/car/Purchase.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/car/Style.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Content/base/jquery.simplemodal.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Content/base/basic.css")" rel="stylesheet" type="text/css" />
}
<div class="hh">
</div>
<div class="main">
    <fieldset>
        <legend>收货人信息</legend>
        <ul class="uladdress">
            @foreach (var item in Model.Address)
            { 
                <li id="ul-@item.AddressID" data-id="@item.AddressID" delive-data="@item.Area.DeliveType">
                    <span>
                        @item.LinkMan
                    </span><span>
                        @item.Provice.proviceName
                    </span><span>
                        @item.City.cityName
                    </span><span>
                        @item.Area.areaName
                    </span><span>
                        @item.AddressPlace
                    </span><span><a href="/MyKunlun/AddressEdit/@item.AddressID?path=/MyKunlun/Purchase">
                        修改</a> </span></li>
            }
            <ol>
                <a href="/MyKunlun/AddressAdd?url=/MyKunlun/Purchase">添加新地址</a></ol>
        </ul>
    </fieldset>
    <fieldset>
        <legend>配送方式</legend>
        <dl class="uldelive">
            @foreach (var item in Model.DeliveType)
            { 
                <dd id="deliver-@item.ID" data-id="@item.ID">
                    <span>
                        @item.Name
                    </span><span>
                        @string.Format("{0:F}", item.Fees)
                    </span>
                </dd>
            }
        </dl>
    </fieldset>
    <fieldset>
        <legend>支付方式</legend>
        <dl class="ulpay">
            @foreach (var item in Model.Paymethod)
            { 
                <dd id="pay-@item.ID" data-id="@item.ID">
                    <span>
                        @item.Name
                    </span><span>
                        @item.Description
                    </span>
                </dd>
            }
        </dl>
    </fieldset>
    <fieldset>
        <legend>商品及价格</legend>
        <table class="items" cellpadding="0" cellspacing="0">
            <tr>
                <th>
                    编号
                </th>
                <th>
                    图片
                </th>
                <th>
                    商品名称
                </th>
                <th>
                    规格
                </th>
                <th>
                    单价
                </th>
                <th>
                    数量
                </th>
            </tr>
            @foreach (var item in Model.UserCartViewModels.Where(o => o.Types != 0))
            {
                List<Kunlun.ViewModels.UserCartViewModels> citems = Model.UserCartViewModels.Where(o => o.Index == item.Index && o.PID != item.PID).ToList();
                <tr id="row-@item.Index" class="Goods_First">
                    <td rowspan='@(citems.Count + 1)' class="index">@item.Index
                    </td>
                    <td class="img">
                        <img alt="" src="@string.Format("{0}{1}", System.Configuration.ConfigurationManager.AppSettings["ImageHttp"], item.Thumnail)" onload="DrawImage(this,100,100);"/>
                    </td>
                    <td>
                        @item.Product - @(item.Types != 0 ? ((FrameType)item.Types).ToString() : "")
                    </td>
                    <td>
                        @item.Propertys
                    </td>
                    <td>
                        @item.Prices.ToString("C")
                    </td>
                    <td rowspan='@(citems.Count + 1)'>
                        @item.Numbers
                    </td>
                </tr>
	  
	  
                   foreach (Kunlun.ViewModels.UserCartViewModels citem in citems)
                   {
                <tr id="row-@item.Index">
                    <td class="img">
                        <img alt="" src="@string.Format("{0}{1}", WebLog.ImageHttp, ProductImageToThum.Thumbnail(citem.Thumnail))" onload="DrawImage(this,80,80);"/>
                    </td>
                    <td>
                        @citem.Product @(citem.Level != 0 ? "-" + ((FrameType)citem.Types).ToString() : "")
                    </td>
                    <td>
                        @citem.Propertys
                    </td>
                    <td>
                        @citem.Prices.ToString("C")
                    </td>
                </tr>
                   }
            }
            <tr>
                <td colspan="7" class="money">
                    运费：<span id="DeliverPrice"></span> 货品金额：<span>@string.Format("{0:F}", ViewBag.Allprice)</span>
                </td>
            </tr>
        </table>
    </fieldset>
    <p class="c">
        <input type="checkbox" onclick="if(this.checked){$('#invoiceTxt').show();}else{$('#invoiceTxt').hide();}" />
        索取发票
    </p>
    <p id="invoiceTxt" class="c" style="display: none;">
        发票抬头：<input id="Invoice" type="text" /></p>
</div>
<p class="bot">
    <span>@Html.ActionLink("上一步", "Cart")</span> <span><a href="javascript:;" id="saveorder">
        提交订单</a></span></p>
<div id="basic-modal-content">
    <dl>
        <dt>登录网上银行付款</dt>
        <dd>
            请在新开网银页面完成付款后选择：</dd>
        <dd>
            付款成功： @Html.ActionLink("查看消费记录", "Order", new { @target = "_blank" })</dd>
        <dd>
            付款失败： <a target="_blank" href="@Url.Content("~/Help/Question/12")">查看支付帮助</a></dd>
    </dl>
</div>
